<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="../css/reset.css">
    <script src="../js/vue.js"></script>
    <style>
        html{
            /* 设置rem:  1rem=100px(设计图) */
            font-size: -webkit-calc(100vw/7.5);
        }
        body{
            font-size: 0.24rem;
        }
        html,body,#app{
            width: 100%;
            height: 100%;
        }
        #app{
            display: flex;
            flex-direction: column;
            justify-content: space-between;
        }
        #app .main{
            flex: 1;
            overflow-y: auto;
        }
        #app .footer{
            height: 0.8rem;
            line-height: 0.8rem;
            text-align: center;
            display: flex;
            border-top: 1px solid #707070;
        }
        #app .footer a{
            flex:1;
        }
    </style>
</head>
<body>
    <div id="app">

        <!-- <div class="main">
            主页的内容
        </div> -->
        <component class="main" :is="compName"></component>
        <div class="footer">
            <a @click="compName='home'">首页</a>
            <a @click="compName='list'">列表</a>
            <a @click="compName='car'">购物车</a>
            <a @click="compName='mine'">我的</a>
        </div>
    </div>
</body>
<script>

    let Home = {
        template:`<div class="home">
            主页的内容
        </div>`
    }

    let List = {
        template:`<div class="list">
            列表的内容
        </div>`
    }

    let Car = {
        template:`<div class="car">
            购物车的内容
        </div>`
    }

    let Mine = {
        template:`<div class="mine">
            我的内容
        </div>`
    }


    var app = new Vue({
        el:"#app",
        data:{
            compName:"home"
        },
        components:{
            Home,
            List,
            Car,
            Mine
        }
    })
</script>
</html>